package br.com.SGF.domain;

import java.io.Serializable;
import java.sql.Time;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@SuppressWarnings("serial")
@Entity
@Table(name = "cadastro_atendimento")
@NamedQueries({ @NamedQuery(name = "Atendimento.listar", query = "SELECT atendimento FROM AtendimentoDomain atendimento") })
public class AtendimentoDomain implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ate_id")
	private int codigo;

	@Temporal(TemporalType.DATE)
	@Column(name = "ate_datainicio")
	private Date dataInicio;

	@Temporal(TemporalType.TIME)
	@Column(name = "ate_horainicio")
	private Date horaInicio;

	@Temporal(TemporalType.DATE)
	@Column(name = "ate_datafim")
	private Date dataFim;

	@Temporal(TemporalType.TIME)
	@Column(name = "ate_horafim")
	private Date horaFim;

	@Column(name = "ate_descricao", length = 50)
	private String descricao;

	@Column(name = "ate_naocompareceu", columnDefinition = "tinyint default false")
	private boolean naoCompareceu;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ate_sen_id", referencedColumnName = "sen_id")
	private SenhaDomain senha = new SenhaDomain();

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ate_cli_id", referencedColumnName = "cli_id")
	private ClienteDomain cliente = new ClienteDomain();

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ate_clo_id", referencedColumnName = "clo_id")
	private LocalDomain local = new LocalDomain();

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ate_cdo_id", referencedColumnName = "cdo_id")
	private MacroServicoDomain macroServico = new MacroServicoDomain();

//	@ManyToOne(fetch = FetchType.EAGER)
//	@JoinColumn(name = "ate_usu_id", referencedColumnName = "usu_id")
//	private UsuarioDomain usuario = new UsuarioDomain();

	public int getCodigo() {
		return codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}

	public Date getDataInicio() {
		if (dataInicio == null) {
			dataInicio = new Date(System.currentTimeMillis());
		}
		return dataInicio;
	}

	public void setDataInicio(Date dataInicio) {
		this.dataInicio = dataInicio;
	}

	public Date getHoraInicio() {
		if (horaInicio == null) {
			horaInicio = new Time(System.currentTimeMillis());
		}
		return horaInicio;
	}

	public void setHoraInicio(Date horaInicio) {

		this.horaInicio = horaInicio;
	}

	public Date getDataFim() {
		if (dataFim == null) {
			dataFim = new Date(System.currentTimeMillis());
		}
		return dataFim;
	}

	public void setDataFim(Date dataFim) {
		this.dataFim = dataFim;
	}

	public Date getHoraFim() {
		if (horaFim == null) {
			horaFim = new Time(System.currentTimeMillis());
		}
		return horaFim;
	}

	public void setHoraFim(Date horaFim) {
		this.horaFim = horaFim;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public boolean isNaoCompareceu() {
		return naoCompareceu;
	}

	public void setNaoCompareceu(boolean naoCompareceu) {
		this.naoCompareceu = naoCompareceu;
	}

	public SenhaDomain getSenha() {
		return senha;
	}

	public void setSenha(SenhaDomain senha) {
		this.senha = senha;
	}

	public ClienteDomain getCliente() {
		return cliente;
	}

	public void setCliente(ClienteDomain cliente) {
		this.cliente = cliente;
	}

	public LocalDomain getLocal() {
		return local;
	}

	public void setLocal(LocalDomain local) {
		this.local = local;
	}

	public MacroServicoDomain getMacroServico() {
		return macroServico;
	}

	public void setMacroServico(MacroServicoDomain macroServico) {
		this.macroServico = macroServico;
	}

//	public UsuarioDomain getUsuario() {
//		return usuario;
//	}
//
//	public void setUsuario(UsuarioDomain usuario) {
//		this.usuario = usuario;
//	}

}
